Adding "Strikethrough" Markup to Object Heading and Text

Dear all,

I want to set a script in a trigger on a status attribute that should add or remove strike-through markup on the object heading and text.

If the attribute is set to a certain state (like "deleted") the mark-up "strikethrough" should be added to all text in the Object Heading and Object Text but without loosing other markup (like bold, bullets, etc.)

Less important but nice to have: if the status is set to something else, the strikethrough markup should be removed, again without loosing other markup.

Does any of you have an idea how to solve this? everything I have come up with so far either produces broken RTF or removes all other mark-up.

Thanks for your help and best Regards,
Alexander
SystemAdmin - Mon Mar 14 07:53:58 EDT 2011

Re: Adding "Strikethrough" Markup to Object Heading and Text
Mathias Mamsch - Mon Mar 14 08:53:41 EDT 2011

See this post. Regards, Mathias

Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Adding "Strikethrough" Markup to Object Heading and Text
SystemAdmin - Tue Mar 15 07:40:48 EDT 2011

Mathias Mamsch - Mon Mar 14 08:53:41 EDT 2011
See this post. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Thanks for the link Mathias.

I tried out your code snippet, but it won't work if there are bullet points involved (only the first bullet ist affected, the rest remains unchanged)
 

string s = richTextFragment richTextWithOle (object 5)."Object Text"
(object 5)."Object Text" = richText ("{\\rtf1 \\strike " s "}")

 


Has there been any development on this issue since that thread's last post?

 

Re: Adding "Strikethrough" Markup to Object Heading and Text
Mathias Mamsch - Tue Mar 15 08:28:49 EDT 2011

SystemAdmin - Tue Mar 15 07:40:48 EDT 2011

Thanks for the link Mathias.

I tried out your code snippet, but it won't work if there are bullet points involved (only the first bullet ist affected, the rest remains unchanged)
 

string s = richTextFragment richTextWithOle (object 5)."Object Text"
(object 5)."Object Text" = richText ("{\\rtf1 \\strike " s "}")

 


Has there been any development on this issue since that thread's last post?

 

Hmm I tried and I indeed had some issues with bullets (but not exactly the ones you described). They went way, when I added braces {} around the richText string.
 

string s = richTextFragment richTextWithOle (object 3)."Object Text"
(object 1)."Object Text" = richText ("{\\rtf1 \\strike {" s "}}")

 


Can you try that version?

Regards, Mathias

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: Adding "Strikethrough" Markup to Object Heading and Text
llandale - Tue Mar 15 10:31:32 EDT 2011

I see Mathias response. I tend to go overboard, so here goes some thoughts. You want to add strike-through code when it becomes "Deleted" and want to remove it when it becomes not "Deleted". Actually, you want to add strike out code only when its not already strike-out, and you want to remove strike-out only when it current IS.

Tried and failed with the following code; got no more time for this.

const string    c_StrikeOut_Prefix      = "{\\rtf1 \\strike {",
                c_StrikeOut_Suffix      = "}}"
//const string  c_StrikeOut_Prefix      = "\\strike ",
//              c_StrikeOut_Suffix      = "\\strike0 "
const int       c_StrikeOut_PrefixLen   = length(c_StrikeOut_Prefix),
                c_StrikeOut_SuffixLen   = length(c_StrikeOut_Suffix)
 
void    StrikeOut_Add(Object in_obj)
{
        if (null in_obj) return
        Buffer  bufText = create()
        bufText = richTextFragment(richTextWithOle(in_obj."Object Text"))
//      bufText = in_obj."Object Text"
        int     LenText = length(bufText)
 
print LenText "\t" c_StrikeOut_PrefixLen "\t" c_StrikeOut_SuffixLen "\t["  bufText "]\n"
print "\t=" bufText[0:c_StrikeOut_PrefixLen-1] "=\n"
print "\t=" bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] "=\n"
 
 
        if(bufText[0:c_StrikeOut_PrefixLen-1] == c_StrikeOut_Prefix     and
           bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] == c_StrikeOut_Suffix
           )                    return  // already StrikeOut
print "Adding...\n"
        Buffer  bufOut = create()
        bufOut  += c_StrikeOut_Prefix
        combine(bufOut, bufText, 0)
        bufOut  += c_StrikeOut_Suffix
 
        in_obj."Object Text" = richText(tempStringOf(bufOut))
        delete(bufText)
        delete(bufOut)
}
 
void    StrikeOut_Remove(Object in_obj)
{
        if (null in_obj) return
        Buffer  bufText = create()
        bufText = richTextFragment(richTextWithOle(in_obj."Object Text"))
//      bufText = in_obj."Object Text"
        int     LenText = length(bufText)
print LenText "\t" c_StrikeOut_PrefixLen "\t" c_StrikeOut_SuffixLen "\t["  bufText "]\n"
print "\t=" bufText[0:c_StrikeOut_PrefixLen-1] "=\n"
print "\t=" bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] "=\n"
 
 
        if(bufText[0:c_StrikeOut_PrefixLen-1] != c_StrikeOut_Prefix     or
           bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] != c_StrikeOut_Suffix
           )                    return  // already StrikeOut
print "Removing...\n"
        Buffer  bufOut = create()
        bufOut  += bufText[c_StrikeOut_PrefixLen:LenText - c_StrikeOut_SuffixLen-1]
 
        in_obj."Object Text" = richText(tempStringOf(bufOut))
        delete(bufText)
        delete(bufOut)
}
 
 
Object  oCurr = current
if     (confirm("Add??"))    StrikeOut_Add(oCurr)
elseif (confirm("Remove??")) StrikeOut_Remove(oCurr)

 

  • Louie